﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Himall.Core;
using Himall.Core.Plugins.Message;
using Himall.IServices;
using Himall.Model;
using Himall.Entity;

namespace Himall.Application
{
    public class MessageApplication
    {
        private static IMessageService _iMessageService = ObjectContainer.Current.Resolve<IMessageService>();
        //更新信息=用户表
        public static  void UpdateMemberContacts(MemberContactsInfo info)
        {
            _iMessageService.UpdateMemberContacts(info);
        }


        /// <summary>
        /// 根据插件类型和ID和目标获取信息
        /// </summary>
        /// <param name="pluginId"></param>
        /// <param name="contact"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static MemberContactsInfo GetMemberContactsInfo(string pluginId, string contact, UserTypes type)
        {
          return  _iMessageService.GetMemberContactsInfo(pluginId, contact, type);
        }

        /// <summary>
        /// 根据用户ID获取目标信息
        /// </summary>
        /// <param name="UserId">用户ID</param>
        /// <returns></returns>
        public static List<MemberContactsInfo> GetMemberContactsInfo(long UserId)
        {
          return   _iMessageService.GetMemberContactsInfo(UserId);
        }

        /// <summary>
        /// 发送验证码
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="info"></param>
        public static void SendMessageCode(string destination, string pluginId, MessageUserInfo info)
        {
             _iMessageService.SendMessageCode(destination, pluginId, info);
        }

        /// <summary>
        /// 发送优惠券成功
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="info"></param>
        public static void SendMessageOnCouponSuccess(long userId, MessageCouponInfo info)
        {
            _iMessageService.SendMessageOnCouponSuccess(userId, info);
        }

    }
}
